package com.open.basic.util;

import com.open.basic.exception.SystemException;
import org.springframework.util.StringUtils;

import java.util.UUID;



public class IdUtils {

    private IdUtils() {
        throw new IllegalStateException("Utility class");
    }

    public static String getStrId() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    public static String getStrId(String module) {
        if (!StringUtils.hasText(module)) {
            throw new SystemException("请指定模块名称");
        }
        return module + getStrId();
    }

    public static Long getLongId() {
        return SnowFlakeUtil.nextIdLong();
    }

    public static void main(String[] args) {
        System.out.println(getLongId());
    }
}
